﻿//        Another Demo from Andy L. & MissedMemo.com
// Borrow whatever code seems useful - just don't try to hold
// me responsible for any ill effects. My demos sometimes use
// licensed images which CANNOT legally be copied and reused.

using System.Windows.Data;
using System.Windows.Media;

using MissedMemo.MeatAndCheeseDisc.OrderEntry.OrderProcessing;


namespace MissedMemo.MeatAndCheeseDisc.OrderEntry
{
    public class OrderStateToColorConverter : IValueConverter
    {
        public Brush ColorScheduled { get; set; }
        public Brush ColorReady { get; set; }
        public Brush ColorCompleted { get; set; }
        public Brush ColorDefault { get; set; }

        
        public object Convert( object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture )
        {
            ProcessingState processingState = (ProcessingState)value;

            if( processingState == ProcessingState.Scheduled )
                return ColorScheduled;

            else if( processingState == ProcessingState.Ready )
                return ColorReady;

            else if( processingState == ProcessingState.Completed )
                return ColorCompleted;

            else
                return ColorDefault;
        }


        public object ConvertBack( object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture )
        {
            throw new System.NotImplementedException();
        }
    }
}
